package com.example.composetest

import app.cash.molecule.RecompositionMode
import app.cash.molecule.moleculeFlow
import app.cash.turbine.test
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.test.runTest
import org.junit.Test

import org.junit.Assert.*

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {
        assertEquals(4, 2 + 2)

    }

    @Test
    fun ss() = runTest {
        val case = MyUseCase()
        val profilePresenter = ProfilePresenter(case)
        moleculeFlow(RecompositionMode.Immediate) {
            profilePresenter.presenter()
        }
            .test {
                assertTrue(awaitItem() is ProfileState.Loading)
                assertTrue(awaitItem() is ProfileState.LoadFinished)
            }
    }
}